﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Soldier : XObjBase
{
    public MeshRenderer meshRenderer;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    private void OnEnable()
    {
        Invoke(nameof(DestroyMe), Random.Range(4, 10));//过段时间，自己销毁

        this.LoadAssetAsync<Texture>(XRes.N("Soldier", XResType.Texture) + Random.Range(1, 6), (texture) =>
        {
            meshRenderer.material.mainTexture = texture;
        });
       
    }

    private void DestroyMe()
    {
        XGameObject.Destroy(this.gameObject);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
